from aStar import aStar
from utils import crd_game_to_gird


def calcTarget(map,player,buffs):
  nearestPonit=None
  routes=None
  for buff in buffs:
    
    routes_=aStar(map,crd_game_to_gird(player[:2]),crd_game_to_gird(buff[:2]))
    if nearestPonit:
      if len(routes_)<len(routes):
        nearestPonit=buff
        routes=routes_
    else:
      nearestPonit=buff
      routes=routes_
  return nearestPonit,routes